<html>
<head><meta charset="utf-8"><title>rename `const_generics_defaults` · project-const-generics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/index.html">project-const-generics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html">rename `const_generics_defaults`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="235063768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/rename%20%60const_generics_defaults%60/near/235063768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html#235063768">(Apr 18 2021 at 11:00)</a>:</h4>
<p><span class="user-mention" data-user-id="121053">@varkor</span> <span class="user-mention" data-user-id="326189">@jknodt</span> <span class="user-mention" data-user-id="116113">@lqd</span> do you mind renaming <code>const_generics_defaults</code> to <code>const_param_defaults</code>?</p>



<a name="235097036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/rename%20%60const_generics_defaults%60/near/235097036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html#235097036">(Apr 18 2021 at 20:15)</a>:</h4>
<p>no objections from me :) (I do wonder if maybe t-lang will decide its actual gate later when they do examine this feature eventually ?)</p>



<a name="235099073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/rename%20%60const_generics_defaults%60/near/235099073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html#235099073">(Apr 18 2021 at 20:44)</a>:</h4>
<p>won't they only look at this feature once we want to stabilize it? <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span> i would like to avoid having to write an rfc for it</p>



<a name="235139941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/rename%20%60const_generics_defaults%60/near/235139941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html#235139941">(Apr 19 2021 at 07:39)</a>:</h4>
<p>there can be MCPs instead of RFCs, but IIUC they usually look at things earlier than stabilization (to avoid a lot of work going into an unexpected feature/direction). defaulted const generics seem safe-ish as the feature already exists for type parameters, but you never know ^^</p>



<a name="235140264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/rename%20%60const_generics_defaults%60/near/235140264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html#235140264">(Apr 19 2021 at 07:42)</a>:</h4>
<p>Defaults for type parameters are only partially supported. For example <a href="https://github.com/Rust-GCC/gccrs/issues/307#issuecomment-808169179">https://github.com/Rust-GCC/gccrs/issues/307#issuecomment-808169179</a>:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nb">Box</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">A</span>: <span class="nb">Default</span> <span class="o">=</span><span class="w"> </span><span class="p">()</span><span class="o">&gt;</span><span class="p">(</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">A</span><span class="p">);</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">A</span>: <span class="nb">Default</span><span class="o">&gt;</span><span class="w"> </span><span class="nb">Box</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">A</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">new</span><span class="p">(</span><span class="n">x</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="nb">Box</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="w"> </span><span class="nb">Default</span>::<span class="n">default</span><span class="p">())</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="nb">Box</span>::<span class="n">new</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<div class="codehilite"><pre><span></span><code>error[E0283]: type annotations needed
  --&gt; src/main.rs:10:5
   |
4  |     fn new(x: T) -&gt; Self {
   |     -------------------- required by `Box::&lt;T, A&gt;::new`
...
10 |     Box::new(1);
   |     ^^^^^^^^ cannot infer type for type parameter `A`
   |
   = note: cannot satisfy `_: Default`

error: aborting due to previous error
</code></pre></div>



<a name="235140328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/rename%20%60const_generics_defaults%60/near/235140328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html#235140328">(Apr 19 2021 at 07:43)</a>:</h4>
<p>sure, and defaulted const generics have a lot of the same limitations IIRC</p>



<a name="235245313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/rename%20%60const_generics_defaults%60/near/235245313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html#235245313">(Apr 19 2021 at 20:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60/near/235063768">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="121053">varkor</span> <span class="user-mention silent" data-user-id="326189">jknodt</span> <span class="user-mention silent" data-user-id="116113">lqd</span> do you mind renaming <code>const_generics_defaults</code> to <code>const_param_defaults</code>?</p>
</blockquote>
<p>But types can already have defaults?</p>



<a name="235246705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/rename%20%60const_generics_defaults%60/near/235246705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html#235246705">(Apr 19 2021 at 20:52)</a>:</h4>
<blockquote>
<p>But types can already have defaults?</p>
</blockquote>
<p>i don't fully understand your question, can you elaborate a bit <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="235246736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/rename%20%60const_generics_defaults%60/near/235246736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html#235246736">(Apr 19 2021 at 20:52)</a>:</h4>
<p>That's why it says "const" before "param"</p>



<a name="235246878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/rename%20%60const_generics_defaults%60/near/235246878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html#235246878">(Apr 19 2021 at 20:53)</a>:</h4>
<p>Or maybe the question was about merging the feature gates?</p>



<a name="235247320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/rename%20%60const_generics_defaults%60/near/235247320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html#235247320">(Apr 19 2021 at 20:57)</a>:</h4>
<p>i am currently thinking a bit about the way we describe stuff, mostly looking at error messages. I think that using "const_generics" when actually referring to const parameters is kinda confusing, so I am looking to change the places where we do that</p>



<a name="235331873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/rename%20%60const_generics_defaults%60/near/235331873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html#235331873">(Apr 20 2021 at 12:09)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60/near/235246736">said</a>:</p>
<blockquote>
<p>That's why it says "const" before "param"</p>
</blockquote>
<p>Sorry, yes, I just completely misread <code>const</code> as <code>generic</code> <span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span></p>



<a name="235332054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/rename%20%60const_generics_defaults%60/near/235332054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/rename.20.60const_generics_defaults.60.html#235332054">(Apr 20 2021 at 12:10)</a>:</h4>
<p>I don't have a strong preference either way.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>